#include"instruction.h"

void instruction::add_imme_op(uint64_t value) {
    immediate_operand* imme_op = new immediate_operand(value);
    operands->push_back(imme_op);
}

void instruction::add_register_op(int id) {
    register_operand* reg_op = new register_operand(id);
    operands->push_back(reg_op);
}

addr_size_t instruction::get_next_instr_addr(addr_size_t addr) {
    if (this->opcode == SMOVI_SMAC || this->opcode == SMOVI_SIEU || this->opcode == VMOVI_VMAC || this->opcode == VMOVI_VIEU) {
        return addr + 10;
    } else {
        return addr + 5;
    }
}

uint32_t instruction::get_opcode() {
    return this->opcode;
}

base_operand* instruction::get_operands(int index) {
    return this->operands->at(index);
}

int8_t instruction::get_ldst_mode() {
    return this->ldst_mode;
}

int8_t instruction::get_hw_id() {
    return this->dst_hw_id;
}

void instruction::set_cond_reg(int8_t reg_id) {
    this->cond_reg = reg_id;
}

void instruction::set_vector_flag(bool v) {
    this->vector = v;
}

void instruction::set_hw_id(int8_t hw_id) {
    this->dst_hw_id = hw_id;
}

void instruction::set_opcode(uint32_t op) {
    this->opcode = op;
}

void instruction::set_ldst_mode(int8_t mode) {
    this->ldst_mode = mode;
}
